package main

import (
	"crypto/tls"
	"fmt"
	"io"
	"log"
	"net/http"
	"time"
)

func main() {
	// 配置 TLS 客户端
	tr := &http.Transport{
		TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
	}
	client := &http.Client{Transport: tr}

	fmt.Println("开始测试 SSL 连接...")

	// 测试多个 HTTPS 请求
	urls := []string{
		"https://httpbin.org/get",
		"https://jsonplaceholder.typicode.com/posts/1",
		"https://api.github.com/users/octocat",
	}

	for i, url := range urls {
		fmt.Printf("请求 %d: %s\n", i+1, url)
		
		resp, err := client.Get(url)
		if err != nil {
			log.Printf("请求失败: %v", err)
			continue
		}

		body, err := io.ReadAll(resp.Body)
		resp.Body.Close()
		
		if err != nil {
			log.Printf("读取响应失败: %v", err)
			continue
		}

		fmt.Printf("响应状态: %s, 内容长度: %d 字节\n", resp.Status, len(body))
		time.Sleep(1 * time.Second)
	}

	fmt.Println("测试完成")
}